<div>
  <div class="pull-right">
    <%= link_to "新建服务网点", new_admin_service_network_path, class: "btn btn-primary" %>
  </div>

  <h1>
    服务网点(<%= @service_networks.total_entries %>)
  </h1>
</div>

<div>
  <table class="table table-striped">
    <tr>
      <th>城市</th>
      <th>网点名</th>
      <th class="text-right">电话</th>
      <th>地址</th>
      <th>操作</th>
    </tr>

    <% @service_networks.each do |service_network| %>
      <tr>
        <td><%= service_network.try(:service_region).try(:name) %></td>
        <td><%= service_network.name %></td>
        <td class="text-right"><%= service_network.phone %></td>
        <td><%= service_network.address %></td>
        <td align="">
          <%= link_to "编辑", edit_admin_service_network_path(service_network) %>
          &nbsp;&nbsp;
          |
          &nbsp;&nbsp;
          
          <% if service_network.deleted? %>
            已删
          <% else %>
            <%= link_to '删除',  admin_service_network_path(service_network), method: :delete, data: {confirm: "确认删除服务网点？"} %>
          <% end %>
        </td>
      </tr>
    <% end -%>
  </table>

  <%= will_paginate @service_networks %>
</div>
